package com.jereh.wymusicapplication.activity.activity;


import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.jereh.wymusicapplication.R;

import java.io.IOException;


public class ExamActivity extends AppCompatActivity {
   private MediaPlayer player;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_exam);
        player =new MediaPlayer();
        Uri uri =Uri.parse("http://yinyueshiting.baidu.com/data2/music/42783748/42783748.mp3?xcode=93212350a33f7a7a0c486914f0acd7b6");
        try {
            player.setDataSource(this,uri);
            player.prepareAsync();
            player.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mp) {
                    player.start();
                }
            });
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}